package hyperlinky;

import java.util.ArrayList;

public class Triggers {
   
	//List which stores all the triggers in
	//Within the list it contains the string match and replacement text
	ArrayList<Trigger> triggerList = new ArrayList<Trigger>();
	public Triggers() {
		//Every Trigger is created and added to the list here
		//triggerList.add(new Trigger("", "", "");
		triggerList.add(new Trigger("h_","Help Blip",""));

		triggerList.add(new Trigger("a_", "Amazon", "http://www.amazon.com/s/ref=nb_ss?url=search-alias%3Daps&field-keywords=%s"));
		triggerList.add(new Trigger("d_", "Dictionary", "http://dictionary.reference.com/browse/%s"));
		triggerList.add(new Trigger("email_", "E-Mail link", "mailto:%s"));
		triggerList.add(new Trigger("f_", "Flickr" , "http://www.flickr.com/search/?q=%s"));
		triggerList.add(new Trigger("gf_", "Froogle" , "http://www.google.com/products?q=%s"));
		triggerList.add(new Trigger("gi_", "Google Images", "http://images.google.com/images?gbv=2&hl=en&q=%s"));
		triggerList.add(new Trigger("gl_", "Google Lucky", "http://www.google.com/search?hl=en&sourceid=navclient&btnI&q=%s"));
		triggerList.add(new Trigger("g_", "Google", "http://www.google.com/#hl=en&q=%s"));
		triggerList.add(new Trigger("i_", "IMDB", "http://www.imdb.com/find?s=tt&q=%s")); 
		triggerList.add(new Trigger("lmgtfy_", "LMGTFY", "http://lmgtfy.com/?q=%s"));
		triggerList.add(new Trigger("t_", "Thesaurus", "http://thesaurus.reference.com/browse/%s"));
		triggerList.add(new Trigger("ts_", "Twitter Search", "http://twitter.com/#search?q=%s"));
		triggerList.add(new Trigger("tu_", "Twitter User", "http://twitter.com/%s"));
		triggerList.add(new Trigger("w_", "Wikipedia", "http://en.wikipedia.org/wiki/%s" ));
	}
    public String toString() {
    	//Figure out how to set a fixed width font so it formats nicer
        String output = "\n\nHelp Blip\nInfo:\t\t\tHyperLinky simplifies linking to common sites.\nUsage:\t\t<Trigger><Search Term>\n"+
            "Examples:\tg_google\tg_\"google wave\"\n\nTrigger\t\tSite\n";
        for(int i = 0; i < triggerList.size(); i++)
        {
            if(triggerList.get(i).getValue() != "h_")
              output += triggerList.get(i).getValue() +"\t\t\t"+ triggerList.get(i).getName() +"\n";
        }
        return output;
    }
}

